//
// Created by Semir on 2020/4/2.
//

#include <iostream>
#include <cmath>

using namespace std;

const int MAX_N = 5010;
int n;
double rate[MAX_N];
int score[MAX_N];
double dp[MAX_N] = {0};

int main() {
    cin >> n;
    for (int i = 1; i <= n; i++) {
        cin >> rate[i];
    }
    for (int i = 1; i <= n; i++) {
        cin >> score[i];
    }
    dp[1] = rate[1] * score[1];
    cout << dp[1] << endl;
    for (int i = 2; i <= n; i++) {
        dp[i] = max(dp[i - 1] + pow(rate[1], n) * score[1], rate[i] * score[i]);
    }
    cout << dp[n] << endl;
    return 0;
}

